<!DOCTYPE html>
<html>
  <head>
    <title>悦淘新房</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
      <link rel="stylesheet" href="${s.base}/mobile/base/css/weui.min.css">
      <link rel="stylesheet" href="${s.base}/mobile/base/css/jquery-weui.css">
      <link rel="stylesheet" href="${s.base}/mobile/wechat/css/base.css">
      <link rel="stylesheet" href="${s.base}/mobile/wechat/css/component.css">
      <link rel="stylesheet" href="${s.base}/mobile/wechat/css/ytxf.css">
      <style type="text/css">

          .xyg-gfzs{
              width:96%;
              height:auto;
              margin:0.5rem 2%;
          }
          .xyg-gfzs .xyg-gfzs-item{
              width:46%;
              height:auto;
              margin: 0.2rem 2%;
              float: left;
              border-radius: 0.3rem;
          }

          .xyg-gfzs .xyg-gfzs-item .xyg-gfzs-item-title{
              font-size:1.2rem;
              font-weight: bold;
              color:#101d37;
              letter-spacing: 0.1rem;
              width: 100%;
              text-align: center;
              height: 2rem;line-height: 2rem;
          }
          .xyg-gfzs .xyg-gfzs-item .xyg-gfzs-item-price{
              font-size:0.8rem;
              color:#c6c9cf;
              width: 100%;
              text-align: center;
              height: 1rem;line-height: 1rem;
          }
          .xyg-comp-menu-three-left-right .clearfix a{color: #666666; font-size: 0.8rem;}
          .xyg-comp-menu-three-left-right .scroller li.cur a {
              color: #000118;
              height:40px;
              font-size: 1rem;
              font-weight: bold;
              border-bottom: 2px solid #cc0000;
          }
          .xyg-comp-menu-three-left-right{border-bottom:0px;}
      </style>
  </head>
  <body>
  <div class="xyg-search">
      <div class="xyg-search-left" id="areaTab">
          <span id="areaShow" data-id="${currentArea.id}">${currentArea.name}</span><span><svg class="icon" aria-hidden="true"><use xlink:href="#iconzelvxuanzefeiyongdaosanjiaoxingfandui"></use></svg></span>
      </div>
      <div class="xyg-search-right">
          <div class="xyg-search-right-content">
              <div class="xyg-search-right-content-icon">
                  <svg class="icon" aria-hidden="true">
                      <use xlink:href="#iconsousuo">
                      </use>
                  </svg>
              </div>
              <input type="text" placeholder="请输入楼盘名称" id="search" readonly />
              <div class="clearBoth"></div>
          </div>
      </div>
      <div class="clearBoth"></div>
  </div>

   <div class="xyg-type">
	</div>
  <!--标题开始-->
  <div class="xyg-comp-nav-1">
      <div class="xyg-comp-nav-1-title">
          <div class="xyg-comp-nav-1-title-content">
              购房资讯
          </div>
          <div class="xyg-comp-nav-1-title-desc">
              查看更多
              <span>
						<svg class="icon" aria-hidden="true">
							<use xlink:href="#iconxiangyou">
							</use>
						</svg>
					</span>
          </div>
          <div class="clearBoth">
          </div>
      </div>
      <div class="xyg-comp-nav-1-icon">
      </div>
  </div>
  <!--标题结束-->
    <div class="xyg-fwxx-article">
    </div>
  <div class="xyg-index">
        <!--左右菜单导航三开始-->
  <div class="wrapper xyg-comp-menu-three-left-right" id="retr">
	  <div class="scroller" style="width: 100%;">
		  <ul class="clearfix">
              <#list hostTypeList as hostType>
                  <#if hostType.id = currentHostType.id>
                      <li style="margin-left: 0px; margin-right: 0px;" class="cur" onclick="changeHostType('${hostType.id}',this)">
                          <a href="javascript:void(0)">${hostType.name}</a>
                      </li>
                      <#else>
                          <li style="margin-left: 0px; margin-right: 0px;" onclick="changeHostType('${hostType.id}',this)">
                              <a href="javascript:void(0)">${hostType.name}</a>
                          </li>
                  </#if>
              </#list>
		  </ul>
	  </div>
  </div>
  <!--左右菜单导航三结束-->
  <!--悦淘新房开始-->
    <div class="xyg-article">

    </div>
    <!--悦淘新房结束-->
  </div>
 
  </body>
  <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  <script src="${s.base}/mobile/base/js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
  <script src="${s.base}/mobile/base/js/jquery-weui.js" type="text/javascript" charset="utf-8"></script>
  <script src="${s.base}/mobile/base/js/component.js?12323434323232323232" type="text/javascript" charset="utf-8"></script>
  <script src="${s.base}/mobile/wechat/fonts/iconfont.js"></script>
  <script src="${s.base}/mobile/wechat/js/window_port.js"></script>
  <script src="${s.base}/mobile/wechat/js/base.js"></script>
  <script src="${s.base}/mobile/wechat/js/iscroll.js"></script>
  <script type="text/javascript">
      var currentCityId='${cityId}';
      var currentAreaId='${currentArea.id}';
      var currentHostTypeId='${currentHostType.id}';
      var memberId='${memberId}';
      $(document).ready(function(e) {
          $("#search").bind("click",function () {
              goSearchPage('${memberId}',currentCityId);
          });
          $("#areaTab").select({
              title: "切换区域",
              items: ${areaSelect},
              onChange: function(d) {
                  $("#areaShow").attr("data-id",d.values);
                  $("#areaShow").html(d.titles);
                  currentAreaId=d.values;
                  pageNum = 1;
                  $(".xyg-article").html("");
                  if(isDestroy){
                      initContentNum();
                  }else{
                      sendPost();
                  }
              }
          });
          initDate();
      });

      function initDate() {
          acceptXygArticleListByColId('20190703211137075075239588275494','-1',currentCityId,function (data) {
              var str='';
              data.forEach(function (item,key,mapObj) {
                  str+='<div onclick="goArticlePage(\'${memberId}\',\''+item.id+'\')" class="xyg-article-item font-grade-one"><img src="/mobile/wechat/images/icon_news.png">'+item.title+'</div>';
              });
              $(".xyg-fwxx-article").html(str);
          });
          //初始化分类
          $('.wrapper').navbarscroll();
          $(".scroller").width("100%");
          //初始化热卖新房
          initContentNum();
      }


      function changeHostType(id,obj) {
          currentHostTypeId=id;
          $(".clearfix li").removeClass("cur");
          $(obj).addClass("cur");
          pageNum = 1;
          $(".xyg-article").html("");
          if(isDestroy){
              initContentNum();
          }else{
              sendPost();
          }
      }


      var memberId='${memberId}';
      var pageNum = 0;
      var pageSize = 5;
      var loading = false;  //状态标记
      var isDestroy = false;  //状态标记
      /**
       * 初始化内容页面信息
       * @param cityId
       */
      function initContentNum() {
          isDestroy = false;
          $(document.body).infinite().on("infinite", function () {
              if (loading) return;
              loading = true;
              sendPost();
          });
          sendPost();
      }

      function sendPost() {
          pageNum++;
          $.fn.postMethodAll("/weChat/hostItem/page",{'pageNum':pageNum,'pageSize':pageSize,'cityId':currentCityId,'areaId':currentAreaId,'hostType':currentHostTypeId},function (result) {
              if (result.data != null && result.data.length > 0) {
                  result.data.forEach(function (item,key,mapObj) {
                      var str='<div class="xyg-article-item borderBottom" onclick="goXqPage(\''+memberId+'\',\''+item.id+'\')">'+
                          '<div class="xyg-article-item-pic">'+
                          '<img src="'+item.coverImage+'" style="width: 96%; height: 100%;"/>'+
                          '</div>'+
                          '<div class="xyg-article-item-content">'+
                          '<div class="xyg-article-item-content-title font-grade-one">'+item.name+'</div>'+
                          '<div class="xyg-article-item-content-author">'+item.cityName+'-'+item.areaName+'<div style="float: right;">'+item.price+'元/m2</div></div>'+
                          '<div class="xyg-article-item-content-author">'+
                          item.minRooms+'-'+item.maxRooms+'室&nbsp;|&nbsp;'+item.minApartmentArea+'-'+item.maxApartmentArea+'m2<!--<div style="float: right;font-size: 16px; font-weight: bold; color: #ff6669;">125万</div>-->'+
                          '</div><div class="xyg-article-item-content-tag">';
                      if(item.tag!=null&&item.tag!=""&&item.tag!="null"){
                          var tags=item.tag.split(",");
                          for(var i=0;i<tags.length;i++){
                              str+='<div class="xyg-article-item-content-tag-title">'+tags[i]+'</div>';
                          }
                      }
                      str+='</div>';

                      if(item.userLogo!=null&&item.userLogo!=""){
                          str+='<div class="xyg-article-item-content-user">'+
                              '<img src="'+item.userLogo+'"/>&nbsp;'+item.userName+'发布楼盘信息</div>';
                      }
                      str+='</div>'+
                          '<div class="clearBoth"></div>'+
                          '</div>';
                      $(".xyg-article").append(str);
                  });
                  loading = false;
                  if (!result.hasNextPage) {
                      $(document.body).destroyInfinite();
                      isDestroy=true;
                  }
              } else {
                  $(document.body).destroyInfinite();
                  isDestroy=true;
              }
          });
      }
  </script>
  
</html>

